using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class Setting : MonoBehaviour
{
    public Animator[] Anims;
    public Slider[] Sliders;
    public Text[] Texts;
    private bool Using = false;
    public void Start(){
        Sliders[0].value = 1.0f;
    }

    public void LateUpdate(){
        if (Input.GetMouseButtonUp(0)){
            Using = false;
        }
        if(!Using){
            Anims[1].SetBool("State",false);
        }
    }
    public void HealthBar(){
        if(SystemCtrollor.isHealthBarActive){
            Anims[0].SetBool("State",false);
            SystemCtrollor.isHealthBarActive = false;
        }
        else{
            Anims[0].SetBool("State",true);
            SystemCtrollor.isHealthBarActive = true;
        }
    }
    public void SoundVolumeBar(){
        Using = true;
        SetSoundVolume(Sliders[0],Anims[1]);
        Texts[0].text = ((int)(Sliders[0].value * 100)).ToString() + "%";
    }
    private void SetSoundVolume(Slider Changeby,Animator Animby){
        Animby.SetBool("State",true);
        SoundCtrollor.ChangeVolume(Changeby.value);
    }
}
